import { createStore } from 'vuex'
import createPersistedState from 'vuex-persistedstate'

import cart from './modules/cart'
import user from './modules/user'
import category from './modules/category'

export default createStore({

  modules: {
    cart,
    user,
    category
  },
  //配置插件
  plugins: [createPersistedState({
    //key表示存储的key值
    key: 'local-store',
    //paths代表存储哪些state，如果是模块下具体的数据需要加上模块名称，如user.token
    paths: ['user', 'cart']
  })]
})

